trait TraitName {
    fn method_name(&self) -> Self;
}

trait BaseTrait {
    fn base_method(&self) -> String;
}

trait Trait: BaseTrait {
    fn base_method(&self) -> String;
}

trait TypeTrait {
    type Type;

    fn new_type(&self) -> Option<Self::Type>;
}

struct TypeStruct {}

impl TypeTrait for TypeStruct {
    type Type = TypeStruct;

    fn new_type(&self) -> Option<Self::Type> {
        println!("TypeStruct");
        None
    }
}

#[test]
fn test_type_trait() {}

mod new_trait_mod {

    trait NewTrait {
        // 类型关联函数
        fn new() -> Self;
    }

    struct CharData {
        data: char,
    }

    impl NewTrait for CharData {
        fn new() -> Self {
            let mut char_data = CharData { data: '\0' };
            char_data
        }
    }

    #[test]
    fn test_new_trait() {
        let char_data = CharData::new();
        println!("char_data.data:{:?}", char_data.data);
    }
}
